]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
NetworkMenu: fix logic for updating wifi icon
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 29 Oct 2011 12:35:09 +0000 (14:35 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Fri, 4 Nov 2011 09:19:20 +0000 (10:19 +0100)
Previously, we connected to notify::strength only if there was
already a signal connected, and the AP changed (thus, by induction,
we never connected). As a result, the icon became stale and different
from that shown inside the menu (which is correctly updated).

https://bugzilla.gnome.org/show_bug.cgi?id=650007

js/ui/status/network.js

index 456b51fe457f7552d0cc42d9d3cd5831e9c622bc..aa9e2342a9023ea482794af224f995dca8a33885 100644 (file)
@@ -2065,10 +2065,11 @@ NMApplet.prototype = {
                         }
                         this.setIcon('network-wireless-connected');
                     } else {
-                        if (this._accessPointUpdateId && this._activeAccessPoint != ap) {
-                            this._activeAccessPoint.disconnect(this._accessPointUpdateId);
+                        if (this._activeAccessPoint != ap) {
+                            if (this._accessPointUpdateId)
+                                this._activeAccessPoint.disconnect(this._accessPointUpdateId);
                             this._activeAccessPoint = ap;
-                            this._activeAccessPointUpdateId = ap.connect('notify::strength', Lang.bind(function() {
+                            this._activeAccessPointUpdateId = ap.connect('notify::strength', Lang.bind(this, function() {
                                 this.setIcon('network-wireless-signal-' + signalToIcon(ap.strength));
                             }));
                         }
@@ -2095,8 +2096,9 @@ NMApplet.prototype = {
                     break;
                 }
 
-                if (this._mobileUpdateId && this._mobileUpdateDevice != dev) {
-                    this._mobileUpdateDevice.disconnect(this._mobileUpdateId);
+                if (dev.mobileDevice != this._mobileUpdateDevice) {
+                    if (this._mobileUpdateId)
+                        this._mobileUpdateDevice.disconnect(this._mobileUpdateId);
                     this._mobileUpdateDevice = dev.mobileDevice;
                     this._mobileUpdateId = dev.mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() {
                         this.setIcon('network-cellular-signal-' + signalToIcon(dev.mobileDevice.signal_quality));